<%@ Page Culture="en-US" UICulture="en-US" Language="C#" Explicit="true" Debug="true"%>

<%@ OutputCache Location="None" VaryByParam="None" %>

<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Data.OleDb" %>
<%@Import Namespace="System.Globalization"%>
<%@Import Namespace="System.Threading"%>



<Script LANGUAGE="C#" runat="server">

  //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  // To convert the SQL Server versions to MS Access do the following:-
  //   Replace the 2 DSN lines
  //   Replace all code of:-   SQLCommand   to   OleDbCommand
  //   Replace all code of:-   SQLDatareader   to   OleDbDatareader
  //   Replace Dates from '  to #  (do not need ' for SQL Server)  (eg strStartDate = "#" & strStartDate & "#")
  //   Change Function DateConvitfromformUS, also  (see comments in Function itself)
  //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

string strPKID;
string strAction;


  //NET 1.1
  //OleDbConnection objConn = new OleDbConnection(ConfigurationSettings.AppSettings["DSN"]);
  //NET 2.0
  SqlConnection objConn = new SqlConnection(ConfigurationManager.AppSettings["DSN"]);
        
    //=======================================================================================
    // NOTE:-
    //Code that can be Customised are marked by &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
    //
    //=======================================================================================


    void Page_Load() 
    {
            strAction = Convert.ToString(Request.QueryString["action"]);

            strPKID = Convert.ToString(Request.QueryString["num"]);     //passed PK_ID key

            switch (strAction) 
            {
              case "chkpageTrue":
                UpdateDBaseTrue();
                break;
              case "chkpageFalse":
                UpdateDBaseFalse();
                break;
            }

           
            Response.Write(" ");      //pass back nothing
            Response.End();

    }


    //&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
    //Change as required
    //------------------------------------------------
    void UpdateDBaseTrue()
    {
          string strSql;
          SqlCommand objCmd;

          Session.LCID=1033;  //3081-AUS   1033-US   2057-BRITISH

          strSql = "UPDATE ARRAYS2 SET Complete_Flag = 'True'   "
                       + " WHERE PK_ID = " + strPKID + "";

                  //================================================================================
                  //These next fields are needed for when checking in multi-user environment if a record has changed
                  //These fields should be default in every Table
                  //               
                  //                "LastUpdated ='" + FormatDateTime(now(),3)  + "', " 
                  //                "RemoteUser ='" + Request.ServerVariables["REMOTE_ADDR"]  + "', " 
                  //                "AuthUser ='" + Request.ServerVariables["AUTH_USER"]  + "', " 
                  //================================================================================

            objCmd = new SqlCommand(strSql, objConn);

            objConn.Open();
            objCmd.ExecuteNonQuery();
            objConn.Close();

     }
     //&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&


    //&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
    //Change as required
    //------------------------------------------------
    void UpdateDBaseFalse()
    {
          string strSql;
          SqlCommand objCmd;

          Session.LCID=1033;  //3081-AUS   1033-US   2057-BRITISH

          strSql = "UPDATE ARRAYS2 SET Complete_Flag = 'False'   "
                       + " WHERE PK_ID = " + strPKID + "";

                  //================================================================================
                  //These next fields are needed for when checking in multi-user environment if a record has changed
                  //These fields should be default in every Table
                  //               
                  //                "LastUpdated ='" + FormatDateTime(now(),3)  + "', " 
                  //                "RemoteUser ='" + Request.ServerVariables["REMOTE_ADDR"]  + "', " 
                  //                "AuthUser ='" + Request.ServerVariables["AUTH_USER"]  + "', " 
                  //================================================================================

            objCmd = new SqlCommand(strSql, objConn);

            objConn.Open();
            objCmd.ExecuteNonQuery();
            objConn.Close();

     }
     //&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&


</Script> 



<HTML>
<HEAD>

</HEAD>
<BODY>

<form id="form1" method="post" runat="server">

</form>

</BODY>
</HTML>


